// SPI.h

#ifndef DRV_SOFT_SPI_H
#define DRV_SOFT_SPI_H



// Define SPI modes
#define SPI_MODE0 0
#define SPI_MODE1 1
#define SPI_MODE2 2
#define SPI_MODE3 3

// SPI configuration structure
typedef struct {
    unsigned char mode;
} SPI_Config_t;

// SPI operations structure
typedef struct {
    unsigned char initialized;    // Indicates if SPI is initialized
    unsigned char busy;           // Indicates if SPI is busy
    void          (*init)(unsigned char mode);
    void          (*transmit)(unsigned char dat);
    unsigned char (*receive)(void);
} SPI_Operations;

// Function prototypes
void          SPI_Init(unsigned char mode);
void          SPI_Transmit(unsigned char dat);
unsigned char SPI_Receive(void);
void          SPI_SetupPins(void);
void          SPI_PollingReceive(void);

// External declaration of the SPI operations instance
extern SPI_Operations spi;



#endif    // DRV_SOFT_SPI_H
